﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class search : System.Web.UI.Page
{
    public const String SEARCH_KEYWORD_PARAMETER_NAME = "keyword";

    ctpDataContext db = new ctpDataContext();

    protected void Page_Load(object sender, EventArgs e)
    {

        string text = Request["text"];
        if (text != null && text.Trim() != "")
        {
           this.searchit0(text);
        }


    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!DataUtil.IsEmptyString(this.TextBox1.Text))
        {
            searchit0(this.TextBox1.Text);
        }
    }

    private void searchit0(String keyword)
    {
        String searchurl = "search_result.aspx?" + Citiport.UI.Const.SEARCH_KEYWORD_PARAMETER_NAME+"="+keyword;
        if (!IsKeywordEmpty(keyword))
            Response.Redirect(searchurl);
    }

    private bool IsKeywordEmpty(string keyword)
    {
        if(DataUtil.IsEmptyString(keyword))
            return true;
        return false;
    }
   
    
 

}
